/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author dukynguyen
 */
@Entity
@Table(name = "Account", catalog = "eProjectNational_Level_Paper", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Account.findAll", query = "SELECT a FROM Account a"),
    @NamedQuery(name = "Account.findByUsername", query = "SELECT a FROM Account a WHERE a.username = :username"),
    @NamedQuery(name = "Account.findByPassword", query = "SELECT a FROM Account a WHERE a.password = :password"),
    @NamedQuery(name = "Account.findByFullname", query = "SELECT a FROM Account a WHERE a.fullname = :fullname"),
    @NamedQuery(name = "Account.findByEmail", query = "SELECT a FROM Account a WHERE a.email = :email"),
    @NamedQuery(name = "Account.findByGender", query = "SELECT a FROM Account a WHERE a.gender = :gender"),
    @NamedQuery(name = "Account.findByBirthday", query = "SELECT a FROM Account a WHERE a.birthday = :birthday"),
    @NamedQuery(name = "Account.findByPhone", query = "SELECT a FROM Account a WHERE a.phone = :phone"),
    @NamedQuery(name = "Account.findBySchool", query = "SELECT a FROM Account a WHERE a.school = :school"),
    @NamedQuery(name = "Account.findByDateJoin", query = "SELECT a FROM Account a WHERE a.dateJoin = :dateJoin"),
    @NamedQuery(name = "Account.findByRole", query = "SELECT a FROM Account a WHERE a.role = :role"),
    @NamedQuery(name = "Account.findByIDelete", query = "SELECT a FROM Account a WHERE a.iDelete = :iDelete")})
public class Account implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Username", nullable = false, length = 100)
    private String username;
    @Column(name = "Password", length = 100)
    private String password;
    @Column(name = "Fullname", length = 100)
    private String fullname;
    @Column(name = "Email", length = 100)
    private String email;
    @Column(name = "Gender", length = 50)
    private String gender;
    @Column(name = "Birthday", length = 50)
    private String birthday;
    @Lob
    @Column(name = "Avatar", length = 1073741823)
    private String avatar;
    @Lob
    @Column(name = "Address", length = 1073741823)
    private String address;
    @Column(name = "Phone", length = 50)
    private String phone;
    @Column(name = "School", length = 100)
    private String school;
    @Column(name = "DateJoin")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateJoin;
    @Column(name = "Role", length = 50)
    private String role;
    @Column(name = "iDelete")
    private Boolean iDelete;
    @OneToMany(mappedBy = "account")
    private Collection<Document> documentCollection;
    @OneToMany(mappedBy = "account")
    private Collection<Comment> commentCollection;
    @OneToMany(mappedBy = "account")
    private Collection<FeedBack> feedBackCollection;
    @OneToMany(mappedBy = "account")
    private Collection<Payment> paymentCollection;

    public Account() {
    }

    public Account(String username) {
        this.username = username;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    public Date getDateJoin() {
        return dateJoin;
    }

    public void setDateJoin(Date dateJoin) {
        this.dateJoin = dateJoin;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public Boolean getIDelete() {
        return iDelete;
    }

    public void setIDelete(Boolean iDelete) {
        this.iDelete = iDelete;
    }

    public Collection<Document> getDocumentCollection() {
        return documentCollection;
    }

    public void setDocumentCollection(Collection<Document> documentCollection) {
        this.documentCollection = documentCollection;
    }

    public Collection<Comment> getCommentCollection() {
        return commentCollection;
    }

    public void setCommentCollection(Collection<Comment> commentCollection) {
        this.commentCollection = commentCollection;
    }

    public Collection<FeedBack> getFeedBackCollection() {
        return feedBackCollection;
    }

    public void setFeedBackCollection(Collection<FeedBack> feedBackCollection) {
        this.feedBackCollection = feedBackCollection;
    }

    public Collection<Payment> getPaymentCollection() {
        return paymentCollection;
    }

    public void setPaymentCollection(Collection<Payment> paymentCollection) {
        this.paymentCollection = paymentCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (username != null ? username.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Account)) {
            return false;
        }
        Account other = (Account) object;
        if ((this.username == null && other.username != null) || (this.username != null && !this.username.equals(other.username))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Account[username=" + username + "]";
    }

}
